<?php
require_once 'ZExt_Twig_Loader.php';
class ZExt_Twig extends Zend_View_Abstract
{

  private $_twig = null;

  public function __construct($applicationRoot, $modulesDir = "")
  {
    $twigLoader = new Twig_Loader_Filesystem($applicationRoot, $modulesDir);
    $this->_twig = new Twig_Environment($twigLoader);
  }

  protected function _run()
  {
    $template = func_get_arg(0);
    echo $template->render($this->getVars());
  }

  protected function _script($name)
  {
    return $this->_twig->loadTemplate($name);
  }

}
